extends CanvasLayer
@onready var button_1: Button = $MarginContainer/HBoxContainer/Panel/Button1
@onready var button_2: Button = $MarginContainer/HBoxContainer/Panel2/Button2
@onready var button_3: Button = $MarginContainer/HBoxContainer/Panel3/Button3
@onready var bigpic: TextureRect = $MarginContainer/Margin2/Rwdt/Bigpic
@onready var rw_description: Label = $MarginContainer/Margin2/Wzk/RwDescription
@onready var texture_rect_1: TextureRect = $MarginContainer/HBoxContainer/Panel/Button1/TextureRect1
@onready var texture_rect_2: TextureRect = $MarginContainer/HBoxContainer/Panel2/Button2/TextureRect2
@onready var texture_rect_3: TextureRect = $MarginContainer/HBoxContainer/Panel3/Button3/TextureRect3
@onready var quit_2: Button = $MarginContainer/Quit2
@onready var show: Button = $Show
@onready var texture_rect_4: TextureRect = $MarginContainer/HBoxContainer/Panel4/Button4/TextureRect4
@onready var button_4: Button = $MarginContainer/HBoxContainer/Panel4/Button4
@onready var button_5: Button = $MarginContainer/HBoxContainer/Panel5/Button5
@onready var button_6: Button = $MarginContainer/HBoxContainer/Panel6/Button6
@onready var texture_rect_5: TextureRect = $MarginContainer/HBoxContainer/Panel5/Button5/TextureRect5
@onready var texture_rect_6: TextureRect = $MarginContainer/HBoxContainer/Panel6/Button6/TextureRect6
@onready var texture_rect_7: TextureRect = $MarginContainer/HBoxContainer/Panel7/Button7/TextureRect7
@onready var button_7: Button = $MarginContainer/HBoxContainer/Panel7/Button7
@onready var texture_rect_8: TextureRect = $MarginContainer/HBoxContainer/Panel8/Button8/TextureRect8

func _init() -> void:
	Dialogic.signal_event.connect(Dia)
	
func _ready() -> void:
	pass # Replace with function body.


# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
	
	if Dialogic.VAR.xwks:
		show.visible=true
	else:
		show.visible=false
	if Dialogic.VAR.rw6:
		button_6.visible=true
	if Dialogic.VAR.liya:
		texture_rect_6.texture=texture_rect_8.texture
		
func Dia(arguement:String):
	if arguement=="unlockrw5":
		button_5.visible=true
	
	if arguement=="unlockrw7":
		button_7.visible=true
	if arguement=="openrwda":
		self.visible=true
		Dialogic.VAR.renwudangan_opened=true
		quit_2.visible=false
	
		


func _on_button_1_pressed() -> void:
	Dialogic.VAR.evidence_number=11
	print("233333")
	bigpic.texture=texture_rect_1.texture
	rw_description.text="米蕾
	凯特族
	新手律师"

func _on_button_2_pressed() -> void:
	Dialogic.VAR.evidence_number=12
	bigpic.texture=texture_rect_2.texture
	rw_description.text="塞莲娜
	人类
	见习魔法师
	被害人艾达的学生
	学习水系魔法
	我的童年玩伴"


func _on_button_3_pressed() -> void:
	Dialogic.VAR.evidence_number=13
	bigpic.texture=texture_rect_3.texture
	rw_description.text="艾琳
	精灵族
	检察官
	手段狠辣，追求完美的胜利
	"



func _on_quit_2_pressed() -> void:
	self.visible=false
	Dialogic.VAR.renwudangan_opened=false
	


func _on_show_pressed() -> void:
	print(Dialogic.VAR.show_evidence_number)
	Dialogic.VAR.show_evidence_number=Dialogic.VAR.evidence_number
	quit_2.visible=true
	Dialogic.VAR.renwudangan_opened=false
	self.visible=false
	Global.zhuiwen()
	
	
	await get_tree().create_timer(2).timeout
	Dialogic.VAR.evidence_number=0
	Dialogic.VAR.show_evidence_number=0
	


func _on_button_4_pressed() -> void:
	Dialogic.VAR.evidence_number=14
	bigpic.texture=texture_rect_4.texture
	rw_description.text="艾达
	人类
	本案的被害人 死于溺水
	资深魔法师
	被告人塞莲娜的魔法老师
	多年来深入研究水魔法
	和村里人几乎没有交往
	"


func _on_button_5_pressed() -> void:
	Dialogic.VAR.evidence_number=15
	bigpic.texture=texture_rect_5.texture
	rw_description.text="罗娜
	兔族
	兔子咖啡店店长
	这起案件的证人
	"

func _on_button_6_pressed() -> void:
	Dialogic.VAR.evidence_number=16
	if not Dialogic.VAR.liya:
		bigpic.texture=texture_rect_6.texture
		rw_description.text="莉亚（已故）
		人类
		被害人艾达的妹妹"
	elif Dialogic.VAR.liya:
		bigpic.texture=texture_rect_6.texture
		rw_description.text="莉亚
		史莱姆
		被害人艾达的妹妹
		艾达制造了一个外表和妹妹一致的史莱姆
		有智慧"
	


func _on_button_7_pressed() -> void:
	Dialogic.VAR.evidence_number=17
	bigpic.texture=texture_rect_7.texture
	rw_description.text="艾多拉
	人类
	旅行者
	案件的证人
	"
